package com.example.daydayup.designPatterns.study14;

/**
 * Description: 14 观察者模式<br/>
 *
 * @author: wells <br/>
 * @since 2024-04-1 19:25
 */
public class MainTest {

    public static void main(String[] args) {

        // 被观察者 server
        WechatServer server = new WechatServer();

        // 观察者 userZhang userLi userWang
        Observer userZhang = new User("ZhangSan");
        Observer userLi = new User("LiSi");
        Observer userWang = new User("WangWu");

        server.registerObserver(userZhang);
        server.registerObserver(userLi);
        server.registerObserver(userWang);
        server.setInfomation("PHP是世界上最好用的语言！");

        System.out.println("----------------------------------------------");
        server.removeObserver(userZhang);
        server.setInfomation("JAVA是世界上最好用的语言！");

    }

}
